/*
 * @Author: 码上talk|RC
 * @Date: 2021-07-03 15:34:12
 * @LastEditTime: 2022-06-30 15:48:57
 * @LastEditors: 码上talk|RC
 * @Description: 
 * @FilePath: /lejifen-ma/store/index.js
 * @微信:  13680065830
 * @邮箱:  3189482282@qq.com
 * @oops: Just do what I think it is right
 */

import Vue from 'vue';
import Vuex from 'vuex';

import user from './user';

import { localCache } from '../utils/localCache';

Vue.use(Vuex);

const store = new Vuex.Store({
  modules: {
    user
  },
  state: {
    isLogin: false,
    app: {
      platform: ''
    },
    shopList: [],
    shopAccountList: []
  },
  mutations: {
    SET_IS_LOGIN (state, b) {
      state.isLogin = b;
    }
  },
  actions: {
    initApp ({ dispatch, commit }) {
      localCache.getToken() && dispatch('user/getUserInfo');
    }
  }
});

export default store;
